3238. 求出胜利玩家的数目
为保证权益,题目请参考 3238. 求出胜利玩家的数目(From LeetCode).
解决方案1
Python
python
from typing import List
class Solution:
def winningPlayerCount(self, n: int, pick: List[List[int]]) -> int:
winner = set()
player_dict = dict()
for x, y in pick:
if x not in player_dict:
player_dict[x] = dict()
if y not in player_dict[x]:
player_dict[x][y] = 0
player_dict[x][y] += 1
if player_dict[x][y] > x:
winner.add(x)
return len(winner)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17